package com.tedu.egcqmvcboot.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@MapperScan("com.tedu.egcqmvcboot.mapper")
@EnableSwagger2WebMvc
public class Config {
    @Bean
    public Docket CreateRestApi(){
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
                .select().apis(RequestHandlerSelectors.basePackage("com.tedu.egcqmvcboot.controller"))
                .paths(PathSelectors.any())
                .build();
    }
    public ApiInfo apiInfo(){

        return new ApiInfoBuilder().title("用户文章项目")
                .description("用户文章综合练习")
                .version("1.0")
                .contact(new Contact("JJ","www.uuu.cn","1111@uuu.com"))
                .build();

    }

}
